/**
 * jQuery EasyUI 1.4
 * 
 * Copyright (c) 2009-2014 www.jeasyui.com. All rights reserved.
 *
 * Licensed under the GPL license: http://www.gnu.org/licenses/gpl.txt
 * To use it on other terms please contact us at info@jeasyui.com
 *
 */
(function ($) {
    var _1 = 0;
    function _2(a, o) {
        for (var i = 0, _3 = a.length; i < _3; i++) {
            if (a[i] == o) {
                return i;
            }
        }
        return -1;
    };
    function _4(a, o, id) {
        if (typeof o == "string") {
            for (var i = 0, _5 = a.length; i < _5; i++) {
                if (a[i][o] == id) {
                    a.splice(i, 1);
                    return;
                }
            }
        } else {
            var _6 = _2(a, o);
            if (_6 != -1) {
                a.splice(_6, 1);
            }
        }
    };
    function _7(a, o, r) {
        for (var i = 0, _8 = a.length; i < _8; i++) {
            if (a[i][o] == r[o]) {
                return;
            }
        }
        a.push(r);
    };
    function _9(_a) {
        var _b = $.data(_a, "datagrid");
        var _c = _b.options;
        var _d = _b.panel;
        var dc = _b.dc;
        var ss = null;
        if (_c.sharedStyleSheet) {
            ss = typeof _c.sharedStyleSheet == "boolean" ? "head" : _c.sharedStyleSheet;
        } else {
            ss = _d.closest("div.datagrid-view");
            if (!ss.length) {
                ss = dc.view;
            }
        }
        var cc = $(ss);
        var _e = $.data(cc[0], "ss");
        if (!_e) {
            _e = $.data(cc[0], "ss", { cache: {}, dirty: [] });
        }
        return {
            add: function (_f) {
                var ss = ["<style type=\"text/css\" easyui=\"true\">"];
                for (var i = 0; i < _f.length; i++) {
                    _e.cache[_f[i][0]] = { width: _f[i][1] };
                }
                var _10 = 0;
                for (var s in _e.cache) {
                    var _11 = _e.cache[s];
                    _11.index = _10++;
                    ss.push(s + "{width:" + _11.width + "}");
                }
                ss.push("</style>");
                $(ss.join("\n")).appendTo(cc);
                cc.children("style[easyui]:not(:last)").remove();
            }, getRule: function (_12) {
                var _13 = cc.children("style[easyui]:last")[0];
                var _14 = _13.styleSheet ? _13.styleSheet : (_13.sheet || document.styleSheets[document.styleSheets.length - 1]);
                var _15 = _14.cssRules || _14.rules;
                return _15[_12];
            }, set: function (_16, _17) {
                var _18 = _e.cache[_16];
                if (_18) {
                    _18.width = _17;
                    var _19 = this.getRule(_18.index);
                    if (_19) {
                        _19.style["width"] = _17;
                    }
                }
            }, remove: function (_1a) {
                var tmp = [];
                for (var s in _e.cache) {
                    if (s.indexOf(_1a) == -1) {
                        tmp.push([s, _e.cache[s].width]);
                    }
                }
                _e.cache = {};
                this.add(tmp);
            }, dirty: function (_1b) {
                if (_1b) {
                    _e.dirty.push(_1b);
                }
            }, clean: function () {
                for (var i = 0; i < _e.dirty.length; i++) {
                    this.remove(_e.dirty[i]);
                }
                _e.dirty = [];
            }
        };
    };
    function _1c(_1d, _1e) {
        var _1f = $.data(_1d, "datagrid");
        var _20 = _1f.options;
        var _21 = _1f.panel;
        if (_1e) {
            $.extend(_20, _1e);
        }
        if (_20.fit == true) {
            var p = _21.panel("panel").parent();
            _20.width = p.width();
            _20.height = p.height();
        }
        _21.panel("resize", _20);
    };
    function _22(_23) {
        var _24 = $.data(_23, "datagrid");
        var _25 = _24.options;
        var dc = _24.dc;
        var _26 = _24.panel;
        var _27 = _26.width();
        var _28 = _26.height();
        var _29 = dc.view;
        var _2a = dc.view1;
        var _2b = dc.view2;
        var _2c = _2a.children("div.datagrid-header");
        var _2d = _2b.children("div.datagrid-header");
        var _2e = _2c.find("table");
        var _2f = _2d.find("table");
        _29.width(_27);
        var _30 = _2c.children("div.datagrid-header-inner").show();
        _2a.width(_30.find("table").width());
        if (!_25.showHeader) {
            _30.hide();
        }
        _2b.width(_27 - _2a._outerWidth());
        _2a.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_2a.width());
        _2b.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_2b.width());
        var hh;
        _2c.add(_2d).css("height", "");
        _2e.add(_2f).css("height", "");
        hh = Math.max(_2e.height(), _2f.height());
        _2e.add(_2f).height(hh);
        _2c.add(_2d)._outerHeight(hh);
        dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({ position: "absolute", top: dc.header2._outerHeight() });
        var _31 = dc.body2.children("table.datagrid-btable-frozen")._outerHeight();
        var _32 = _31 + _2b.children("div.datagrid-header")._outerHeight() + _2b.children("div.datagrid-footer")._outerHeight() + _26.children("div.datagrid-toolbar")._outerHeight();
        _26.children("div.datagrid-pager").each(function () {
            _32 += $(this)._outerHeight();
        });
        var _33 = _26.outerHeight() - _26.height();
        var _34 = _26._size("minHeight") || "";
        var _35 = _26._size("maxHeight") || "";
        _2a.add(_2b).children("div.datagrid-body").css({ marginTop: _31, height: (isNaN(parseInt(_25.height)) ? "" : (_28 - _32)), minHeight: (_34 ? _34 - _33 - _32 : ""), maxHeight: (_35 ? _35 - _33 - _32 : "") });
        _29.height(_2b.height());
    };
    function _36(_37, _38, _39) {
        var _3a = $.data(_37, "datagrid").data.rows;
        var _3b = $.data(_37, "datagrid").options;
        var dc = $.data(_37, "datagrid").dc;
        if (!dc.body1.is(":empty") && (!_3b.nowrap || _3b.autoRowHeight || _39)) {
            if (_38 != undefined) {
                var tr1 = _3b.finder.getTr(_37, _38, "body", 1);
                var tr2 = _3b.finder.getTr(_37, _38, "body", 2);
                _3c(tr1, tr2);
            } else {
                var tr1 = _3b.finder.getTr(_37, 0, "allbody", 1);
                var tr2 = _3b.finder.getTr(_37, 0, "allbody", 2);
                _3c(tr1, tr2);
                if (_3b.showFooter) {
                    var tr1 = _3b.finder.getTr(_37, 0, "allfooter", 1);
                    var tr2 = _3b.finder.getTr(_37, 0, "allfooter", 2);
                    _3c(tr1, tr2);
                }
            }
        }
        _22(_37);
        if (_3b.height == "auto") {
            var _3d = dc.body1.parent();
            var _3e = dc.body2;
            var _3f = _40(_3e);
            var _41 = _3f.height;
            if (_3f.width > _3e.width()) {
                _41 += 18;
            }
            _41 -= parseInt(_3e.css("marginTop")) || 0;
            _3d.height(_41);
            _3e.height(_41);
            dc.view.height(dc.view2.height());
        }
        dc.body2.triggerHandler("scroll");
        function _3c(_42, _43) {
            for (var i = 0; i < _43.length; i++) {
                var tr1 = $(_42[i]);
                var tr2 = $(_43[i]);
                tr1.css("height", "");
                tr2.css("height", "");
                var _44 = Math.max(tr1.height(), tr2.height());
                tr1.css("height", _44);
                tr2.css("height", _44);
            }
        };
        function _40(cc) {
            var _45 = 0;
            var _46 = 0;
            $(cc).children().each(function () {
                var c = $(this);
                if (c.is(":visible")) {
                    _46 += c._outerHeight();
                    if (_45 < c._outerWidth()) {
                        _45 = c._outerWidth();
                    }
                }
            });
            return { width: _45, height: _46 };
        };
    };
    function _47(_48, _49) {
        var _4a = $.data(_48, "datagrid");
        var _4b = _4a.options;
        var dc = _4a.dc;
        if (!dc.body2.children("table.datagrid-btable-frozen").length) {
            dc.body1.add(dc.body2).prepend("<table class=\"datagrid-btable datagrid-btable-frozen\" cellspacing=\"0\" cellpadding=\"0\"></table>");
        }
        _4c(true);
        _4c(false);
        _22(_48);
        function _4c(_4d) {
            var _4e = _4d ? 1 : 2;
            var tr = _4b.finder.getTr(_48, _49, "body", _4e);
            (_4d ? dc.body1 : dc.body2).children("table.datagrid-btable-frozen").append(tr);
        };
    };
    function _4f(_50, _51) {
        function _52() {
            var _53 = [];
            var _54 = [];
            $(_50).children("thead").each(function () {
                var opt = $.parser.parseOptions(this, [{ frozen: "boolean" }]);
                $(this).find("tr").each(function () {
                    var _55 = [];
                    $(this).find("th").each(function () {
                        var th = $(this);
                        var col = $.extend({}, $.parser.parseOptions(this, ["field", "align", "halign", "order", "width", { sortable: "boolean", checkbox: "boolean", resizable: "boolean", fixed: "boolean" }, { rowspan: "number", colspan: "number" }]), { title: (th.html() || undefined), hidden: (th.attr("hidden") ? true : undefined), formatter: (th.attr("formatter") ? eval(th.attr("formatter")) : undefined), styler: (th.attr("styler") ? eval(th.attr("styler")) : undefined), sorter: (th.attr("sorter") ? eval(th.attr("sorter")) : undefined) });
                        if (col.width && String(col.width).indexOf("%") == -1) {
                            col.width = parseInt(col.width);
                        }
                        if (th.attr("editor")) {
                            var s = $.trim(th.attr("editor"));
                            if (s.substr(0, 1) == "{") {
                                col.editor = eval("(" + s + ")");
                            } else {
                                col.editor = s;
                            }
                        }
                        _55.push(col);
                    });
                    opt.frozen ? _53.push(_55) : _54.push(_55);
                });
            });
            return [_53, _54];
        };
        var _56 = $("<div class=\"datagrid-wrap\">" + "<div class=\"datagrid-view\">" + "<div class=\"datagrid-view1\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\">" + "<div class=\"datagrid-body-inner\"></div>" + "</div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "<div class=\"datagrid-view2\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\"></div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "</div>" + "</div>").insertAfter(_50);
        _56.panel({ doSize: false, cls: "datagrid" });
        $(_50).hide().appendTo(_56.children("div.datagrid-view"));
        var cc = _52();
        var _57 = _56.children("div.datagrid-view");
        var _58 = _57.children("div.datagrid-view1");
        var _59 = _57.children("div.datagrid-view2");
        return { panel: _56, frozenColumns: cc[0], columns: cc[1], dc: { view: _57, view1: _58, view2: _59, header1: _58.children("div.datagrid-header").children("div.datagrid-header-inner"), header2: _59.children("div.datagrid-header").children("div.datagrid-header-inner"), body1: _58.children("div.datagrid-body").children("div.datagrid-body-inner"), body2: _59.children("div.datagrid-body"), footer1: _58.children("div.datagrid-footer").children("div.datagrid-footer-inner"), footer2: _59.children("div.datagrid-footer").children("div.datagrid-footer-inner") } };
    };
    function _5a(_5b) {
        var _5c = $.data(_5b, "datagrid");
        var _5d = _5c.options;
        var dc = _5c.dc;
        var _5e = _5c.panel;
        _5c.ss = $(_5b).datagrid("createStyleSheet");
        _5e.panel($.extend({}, _5d, {
            id: null, doSize: false, onResize: function (_5f, _60) {
                setTimeout(function () {
                    if ($.data(_5b, "datagrid")) {
                        _22(_5b);
                        _9a(_5b);
                        _5d.onResize.call(_5e, _5f, _60);
                    }
                }, 0);
            }, onExpand: function () {
                _36(_5b);
                _5d.onExpand.call(_5e);
            }
        }));
        _5c.rowIdPrefix = "datagrid-row-r" + (++_1);
        _5c.cellClassPrefix = "datagrid-cell-c" + _1;
        _61(dc.header1, _5d.frozenColumns, true);
        _61(dc.header2, _5d.columns, false);
        _62();
        dc.header1.add(dc.header2).css("display", _5d.showHeader ? "block" : "none");
        dc.footer1.add(dc.footer2).css("display", _5d.showFooter ? "block" : "none");
        if (_5d.toolbar) {
            if ($.isArray(_5d.toolbar)) {
                $("div.datagrid-toolbar", _5e).remove();
                var tb = $("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_5e);
                var tr = tb.find("tr");
                for (var i = 0; i < _5d.toolbar.length; i++) {
                    var btn = _5d.toolbar[i];
                    if (btn == "-") {
                        $("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr);
                    } else {
                        var td = $("<td></td>").appendTo(tr);
                        var _63 = $("<a href=\"javascript:void(0)\"></a>").appendTo(td);
                        _63[0].onclick = eval(btn.handler || function () {
                        });
                        _63.linkbutton($.extend({}, btn, { plain: true }));
                    }
                }
            } else {
                $(_5d.toolbar).addClass("datagrid-toolbar").prependTo(_5e);
                $(_5d.toolbar).show();
            }
        } else {
            $("div.datagrid-toolbar", _5e).remove();
        }
        $("div.datagrid-pager", _5e).remove();
        if (_5d.pagination) {
            var _64 = $("<div class=\"datagrid-pager\"></div>");
            if (_5d.pagePosition == "bottom") {
                _64.appendTo(_5e);
            } else {
                if (_5d.pagePosition == "top") {
                    _64.addClass("datagrid-pager-top").prependTo(_5e);
                } else {
                    var _65 = $("<div class=\"datagrid-pager datagrid-pager-top\"></div>").prependTo(_5e);
                    _64.appendTo(_5e);
                    _64 = _64.add(_65);
                }
            }
            _64.pagination({
                total: (_5d.pageNumber * _5d.pageSize), pageNumber: _5d.pageNumber, pageSize: _5d.pageSize, pageList: _5d.pageList, onSelectPage: function (_66, _67) {
                    _5d.pageNumber = _66;
                    _5d.pageSize = _67;
                    _64.pagination("refresh", { pageNumber: _66, pageSize: _67 });
                    _98(_5b);
                }
            });
            _5d.pageSize = _64.pagination("options").pageSize;
        }
        function _61(_68, _69, _6a) {
            if (!_69) {
                return;
            }
            $(_68).show();
            $(_68).empty();
            var _6b = [];
            var _6c = [];
            if (_5d.sortName) {
                _6b = _5d.sortName.split(",");
                _6c = _5d.sortOrder.split(",");
            }
            var t = $("<table class=\"datagrid-htable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>").appendTo(_68);
            for (var i = 0; i < _69.length; i++) {
                var tr = $("<tr class=\"datagrid-header-row\"></tr>").appendTo($("tbody", t));
                var _6d = _69[i];
                for (var j = 0; j < _6d.length; j++) {
                    var col = _6d[j];
                    var _6e = "";
                    if (col.rowspan) {
                        _6e += "rowspan=\"" + col.rowspan + "\" ";
                    }
                    if (col.colspan) {
                        _6e += "colspan=\"" + col.colspan + "\" ";
                    }
                    var td = $("<td " + _6e + "></td>").appendTo(tr);
                    if (col.checkbox) {
                        td.attr("field", col.field);
                        $("<div class=\"datagrid-header-check\"></div>").html("<input type=\"checkbox\"/>").appendTo(td);
                    } else {
                        if (col.field) {
                            td.attr("field", col.field);
                            td.append("<div class=\"datagrid-cell\"><span></span><span class=\"datagrid-sort-icon\"></span></div>");
                            $("span", td).html(col.title);
                            $("span.datagrid-sort-icon", td).html("&nbsp;");
                            var _6f = td.find("div.datagrid-cell");
                            var pos = _2(_6b, col.field);
                            if (pos >= 0) {
                                _6f.addClass("datagrid-sort-" + _6c[pos]);
                            }
                            if (col.resizable == false) {
                                _6f.attr("resizable", "false");
                            }
                            if (col.width) {
                                var _70 = $.parser.parseValue("width", col.width, dc.view, _5d.scrollbarSize);
                                _6f._outerWidth(_70 - 1);
                                col.boxWidth = parseInt(_6f[0].style.width);
                                col.deltaWidth = _70 - col.boxWidth;
                            } else {
                                col.auto = true;
                            }
                            _6f.css("text-align", (col.halign || col.align || ""));
                            col.cellClass = _5c.cellClassPrefix + "-" + col.field.replace(/[\.|\s]/g, "-");
                            _6f.addClass(col.cellClass).css("width", "");
                        } else {
                            $("<div class=\"datagrid-cell-group\"></div>").html(col.title).appendTo(td);
                        }
                    }
                    if (col.hidden) {
                        td.hide();
                    }
                }
            }
            if (_6a && _5d.rownumbers) {
                var td = $("<td rowspan=\"" + _5d.frozenColumns.length + "\"><div class=\"datagrid-header-rownumber\"></div></td>");
                if ($("tr", t).length == 0) {
                    td.wrap("<tr class=\"datagrid-header-row\"></tr>").parent().appendTo($("tbody", t));
                } else {
                    td.prependTo($("tr:first", t));
                }
            }
        };
        function _62() {
            var _71 = [];
            var _72 = _73(_5b, true).concat(_73(_5b));
            for (var i = 0; i < _72.length; i++) {
                var col = _74(_5b, _72[i]);
                if (col && !col.checkbox) {
                    _71.push(["." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto"]);
                }
            }
            _5c.ss.add(_71);
            _5c.ss.dirty(_5c.cellSelectorPrefix);
            _5c.cellSelectorPrefix = "." + _5c.cellClassPrefix;
        };
    };
    function _75(_76) {
        var _77 = $.data(_76, "datagrid");
        var _78 = _77.panel;
        var _79 = _77.options;
        var dc = _77.dc;
        var _7a = dc.header1.add(dc.header2);
        _7a.find("input[type=checkbox]").unbind(".datagrid").bind("click.datagrid", function (e) {
            if (_79.singleSelect && _79.selectOnCheck) {
                return false;
            }
            if ($(this).is(":checked")) {
                _11c(_76);
            } else {
                _122(_76);
            }
            e.stopPropagation();
        });
        var _7b = _7a.find("div.datagrid-cell");
        _7b.closest("td").unbind(".datagrid").bind("mouseenter.datagrid", function () {
            if (_77.resizing) {
                return;
            }
            $(this).addClass("datagrid-header-over");
        }).bind("mouseleave.datagrid", function () {
            $(this).removeClass("datagrid-header-over");
        }).bind("contextmenu.datagrid", function (e) {
            var _7c = $(this).attr("field");
            _79.onHeaderContextMenu.call(_76, e, _7c);
        });
        _7b.unbind(".datagrid").bind("click.datagrid", function (e) {
            var p1 = $(this).offset().left + 5;
            var p2 = $(this).offset().left + $(this)._outerWidth() - 5;
            if (e.pageX < p2 && e.pageX > p1) {
                _8c(_76, $(this).parent().attr("field"));
            }
        }).bind("dblclick.datagrid", function (e) {
            var p1 = $(this).offset().left + 5;
            var p2 = $(this).offset().left + $(this)._outerWidth() - 5;
            var _7d = _79.resizeHandle == "right" ? (e.pageX > p2) : (_79.resizeHandle == "left" ? (e.pageX < p1) : (e.pageX < p1 || e.pageX > p2));
            if (_7d) {
                var _7e = $(this).parent().attr("field");
                var col = _74(_76, _7e);
                if (col.resizable == false) {
                    return;
                }
                $(_76).datagrid("autoSizeColumn", _7e);
                col.auto = false;
            }
        });
        var _7f = _79.resizeHandle == "right" ? "e" : (_79.resizeHandle == "left" ? "w" : "e,w");
        _7b.each(function () {
            $(this).resizable({
                handles: _7f, disabled: ($(this).attr("resizable") ? $(this).attr("resizable") == "false" : false), minWidth: 25, onStartResize: function (e) {
                    _77.resizing = true;
                    _7a.css("cursor", $("body").css("cursor"));
                    if (!_77.proxy) {
                        _77.proxy = $("<div class=\"datagrid-resize-proxy\"></div>").appendTo(dc.view);
                    }
                    _77.proxy.css({ left: e.pageX - $(_78).offset().left - 1, display: "none" });
                    setTimeout(function () {
                        if (_77.proxy) {
                            _77.proxy.show();
                        }
                    }, 500);
                }, onResize: function (e) {
                    _77.proxy.css({ left: e.pageX - $(_78).offset().left - 1, display: "block" });
                    return false;
                }, onStopResize: function (e) {
                    _7a.css("cursor", "");
                    $(this).css("height", "");
                    var _80 = $(this).parent().attr("field");
                    var col = _74(_76, _80);
                    col.width = $(this)._outerWidth();
                    col.boxWidth = col.width - col.deltaWidth;
                    col.auto = undefined;
                    $(this).css("width", "");
                    _bb(_76, _80);
                    _77.proxy.remove();
                    _77.proxy = null;
                    if ($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")) {
                        _22(_76);
                    }
                    _9a(_76);
                    _79.onResizeColumn.call(_76, _80, col.width);
                    setTimeout(function () {
                        _77.resizing = false;
                    }, 0);
                }
            });
        });
        dc.body1.add(dc.body2).unbind().bind("mouseover", function (e) {
            if (_77.resizing) {
                return;
            }
            var tr = $(e.target).closest("tr.datagrid-row");
            if (!_81(tr)) {
                return;
            }
            var _82 = _83(tr);
            _104(_76, _82);
        }).bind("mouseout", function (e) {
            var tr = $(e.target).closest("tr.datagrid-row");
            if (!_81(tr)) {
                return;
            }
            var _84 = _83(tr);
            _79.finder.getTr(_76, _84).removeClass("datagrid-row-over");
        }).bind("click", function (e) {
            var tt = $(e.target);
            var tr = tt.closest("tr.datagrid-row");
            if (!_81(tr)) {
                return;
            }
            var _85 = _83(tr);
            if (tt.parent().hasClass("datagrid-cell-check")) {
                if (_79.singleSelect && _79.selectOnCheck) {
                    if (!_79.checkOnSelect) {
                        _122(_76, true);
                    }
                    _10f(_76, _85);
                } else {
                    if (tt.is(":checked")) {
                        _10f(_76, _85);
                    } else {
                        _116(_76, _85);
                    }
                }
            } else {
                var row = _79.finder.getRow(_76, _85);
                var td = tt.closest("td[field]", tr);
                if (td.length) {
                    var _86 = td.attr("field");
                    _79.onClickCell.call(_76, _85, _86, row[_86]);
                }
                if (_79.singleSelect == true) {
                    _108(_76, _85);
                } else {
                    if (_79.ctrlSelect) {
                        if (e.ctrlKey) {
                            if (tr.hasClass("datagrid-row-selected")) {
                                _110(_76, _85);
                            } else {
                                _108(_76, _85);
                            }
                        } else {
                            $(_76).datagrid("clearSelections");
                            _108(_76, _85);
                        }
                    } else {
                        if (tr.hasClass("datagrid-row-selected")) {
                            _110(_76, _85);
                        } else {
                            _108(_76, _85);
                        }
                    }
                }
                _79.onClickRow.call(_76, _85, row);
            }
        }).bind("dblclick", function (e) {
            var tt = $(e.target);
            var tr = tt.closest("tr.datagrid-row");
            if (!_81(tr)) {
                return;
            }
            var _87 = _83(tr);
            var row = _79.finder.getRow(_76, _87);
            var td = tt.closest("td[field]", tr);
            if (td.length) {
                var _88 = td.attr("field");
                _79.onDblClickCell.call(_76, _87, _88, row[_88]);
            }
            _79.onDblClickRow.call(_76, _87, row);
        }).bind("contextmenu", function (e) {
            var tr = $(e.target).closest("tr.datagrid-row");
            if (!_81(tr)) {
                return;
            }
            var _89 = _83(tr);
            var row = _79.finder.getRow(_76, _89);
            _79.onRowContextMenu.call(_76, e, _89, row);
        });
        dc.body2.bind("scroll", function () {
            var b1 = dc.view1.children("div.datagrid-body");
            b1.scrollTop($(this).scrollTop());
            var c1 = dc.body1.children(":first");
            var c2 = dc.body2.children(":first");
            if (c1.length && c2.length) {
                var _8a = c1.offset().top;
                var _8b = c2.offset().top;
                if (_8a != _8b) {
                    b1.scrollTop(b1.scrollTop() + _8a - _8b);
                }
            }
            dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft());
            dc.body2.children("table.datagrid-btable-frozen").css("left", -$(this)._scrollLeft());
        });
        function _83(tr) {
            if (tr.attr("datagrid-row-index")) {
                return parseInt(tr.attr("datagrid-row-index"));
            } else {
                return tr.attr("node-id");
            }
        };
        function _81(tr) {
            return tr.length && tr.parent().length;
        };
    };
    function _8c(_8d, _8e) {
        var _8f = $.data(_8d, "datagrid");
        var _90 = _8f.options;
        _8e = _8e || {};
        var _91 = { sortName: _90.sortName, sortOrder: _90.sortOrder };
        if (typeof _8e == "object") {
            $.extend(_91, _8e);
        }
        var _92 = [];
        var _93 = [];
        if (_91.sortName) {
            _92 = _91.sortName.split(",");
            _93 = _91.sortOrder.split(",");
        }
        if (typeof _8e == "string") {
            var _94 = _8e;
            var col = _74(_8d, _94);
            if (!col.sortable || _8f.resizing) {
                return;
            }
            var _95 = col.order || "asc";
            var pos = _2(_92, _94);
            if (pos >= 0) {
                var _96 = _93[pos] == "asc" ? "desc" : "asc";
                if (_90.multiSort && _96 == _95) {
                    _92.splice(pos, 1);
                    _93.splice(pos, 1);
                } else {
                    _93[pos] = _96;
                }
            } else {
                if (_90.multiSort) {
                    _92.push(_94);
                    _93.push(_95);
                } else {
                    _92 = [_94];
                    _93 = [_95];
                }
            }
            _91.sortName = _92.join(",");
            _91.sortOrder = _93.join(",");
        }
        if (_90.onBeforeSortColumn.call(_8d, _91.sortName, _91.sortOrder) == false) {
            return;
        }
        $.extend(_90, _91);
        var dc = _8f.dc;
        var _97 = dc.header1.add(dc.header2);
        _97.find("div.datagrid-cell").removeClass("datagrid-sort-asc datagrid-sort-desc");
        for (var i = 0; i < _92.length; i++) {
            var col = _74(_8d, _92[i]);
            _97.find("div." + col.cellClass).addClass("datagrid-sort-" + _93[i]);
        }
        if (_90.remoteSort) {
            _98(_8d);
        } else {
            _99(_8d, $(_8d).datagrid("getData"));
        }
        _90.onSortColumn.call(_8d, _90.sortName, _90.sortOrder);
    };
    function _9a(_9b) {
        var _9c = $.data(_9b, "datagrid");
        var _9d = _9c.options;
        var dc = _9c.dc;
        var _9e = dc.view2.children("div.datagrid-header");
        dc.body2.css("overflow-x", "");
        _9f();
        _a0();
        if (_9e.width() >= _9e.find("table").width()) {
            dc.body2.css("overflow-x", "hidden");
        }
        function _a0() {
            if (!_9d.fitColumns) {
                return;
            }
            if (!_9c.leftWidth) {
                _9c.leftWidth = 0;
            }
            var _a1 = 0;
            var cc = [];
            var _a2 = _73(_9b, false);
            for (var i = 0; i < _a2.length; i++) {
                var col = _74(_9b, _a2[i]);
                if (_a3(col)) {
                    _a1 += col.width;
                    cc.push({ field: col.field, col: col, addingWidth: 0 });
                }
            }
            if (!_a1) {
                return;
            }
            cc[cc.length - 1].addingWidth -= _9c.leftWidth;
            var _a4 = _9e.children("div.datagrid-header-inner").show();
            var _a5 = _9e.width() - _9e.find("table").width() - _9d.scrollbarSize + _9c.leftWidth;
            var _a6 = _a5 / _a1;
            if (!_9d.showHeader) {
                _a4.hide();
            }
            for (var i = 0; i < cc.length; i++) {
                var c = cc[i];
                var _a7 = parseInt(c.col.width * _a6);
                c.addingWidth += _a7;
                _a5 -= _a7;
            }
            cc[cc.length - 1].addingWidth += _a5;
            for (var i = 0; i < cc.length; i++) {
                var c = cc[i];
                if (c.col.boxWidth + c.addingWidth > 0) {
                    c.col.boxWidth += c.addingWidth;
                    c.col.width += c.addingWidth;
                }
            }
            _9c.leftWidth = _a5;
            _bb(_9b);
        };
        function _9f() {
            var _a8 = false;
            var _a9 = _73(_9b, true).concat(_73(_9b, false));
            $.map(_a9, function (_aa) {
                var col = _74(_9b, _aa);
                if (String(col.width || "").indexOf("%") >= 0) {
                    var _ab = $.parser.parseValue("width", col.width, dc.view, _9d.scrollbarSize) - col.deltaWidth;
                    if (_ab > 0) {
                        col.boxWidth = _ab;
                        _a8 = true;
                    }
                }
            });
            if (_a8) {
                _bb(_9b);
            }
        };
        function _a3(col) {
            if (String(col.width || "").indexOf("%") >= 0) {
                return false;
            }
            if (!col.hidden && !col.checkbox && !col.auto && !col.fixed) {
                return true;
            }
        };
    };
    function _ac(_ad, _ae) {
        var _af = $.data(_ad, "datagrid");
        var _b0 = _af.options;
        var dc = _af.dc;
        var tmp = $("<div class=\"datagrid-cell\" style=\"position:absolute;left:-9999px\"></div>").appendTo("body");
        if (_ae) {
            _1c(_ae);
            if (_b0.fitColumns) {
                _22(_ad);
                _9a(_ad);
            }
        } else {
            var _b1 = false;
            var _b2 = _73(_ad, true).concat(_73(_ad, false));
            for (var i = 0; i < _b2.length; i++) {
                var _ae = _b2[i];
                var col = _74(_ad, _ae);
                if (col.auto) {
                    _1c(_ae);
                    _b1 = true;
                }
            }
            if (_b1 && _b0.fitColumns) {
                _22(_ad);
                _9a(_ad);
            }
        }
        tmp.remove();
        function _1c(_b3) {
            var _b4 = dc.view.find("div.datagrid-header td[field=\"" + _b3 + "\"] div.datagrid-cell");
            _b4.css("width", "");
            var col = $(_ad).datagrid("getColumnOption", _b3);
            col.width = undefined;
            col.boxWidth = undefined;
            col.auto = true;
            $(_ad).datagrid("fixColumnSize", _b3);
            var _b5 = Math.max(_b6("header"), _b6("allbody"), _b6("allfooter")) + 1;
            _b4._outerWidth(_b5 - 1);
            col.width = _b5;
            col.boxWidth = parseInt(_b4[0].style.width);
            col.deltaWidth = _b5 - col.boxWidth;
            _b4.css("width", "");
            $(_ad).datagrid("fixColumnSize", _b3);
            _b0.onResizeColumn.call(_ad, _b3, col.width);
            function _b6(_b7) {
                var _b8 = 0;
                if (_b7 == "header") {
                    _b8 = _b9(_b4);
                } else {
                    _b0.finder.getTr(_ad, 0, _b7).find("td[field=\"" + _b3 + "\"] div.datagrid-cell").each(function () {
                        var w = _b9($(this));
                        if (_b8 < w) {
                            _b8 = w;
                        }
                    });
                }
                return _b8;
                function _b9(_ba) {
                    return _ba.is(":visible") ? _ba._outerWidth() : tmp.html(_ba.html())._outerWidth();
                };
            };
        };
    };
    function _bb(_bc, _bd) {
        var _be = $.data(_bc, "datagrid");
        var _bf = _be.options;
        var dc = _be.dc;
        var _c0 = dc.view.find("table.datagrid-btable,table.datagrid-ftable");
        _c0.css("table-layout", "fixed");
        if (_bd) {
            fix(_bd);
        } else {
            var ff = _73(_bc, true).concat(_73(_bc, false));
            for (var i = 0; i < ff.length; i++) {
                fix(ff[i]);
            }
        }
        _c0.css("table-layout", "auto");
        _c1(_bc);
        _36(_bc);
        _c2(_bc);
        function fix(_c3) {
            var col = _74(_bc, _c3);
            if (col.cellClass) {
                _be.ss.set("." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto");
            }
        };
    };
    function _c1(_c4) {
        var dc = $.data(_c4, "datagrid").dc;
        dc.view.find("td.datagrid-td-merged").each(function () {
            var td = $(this);
            var _c5 = td.attr("colspan") || 1;
            var col = _74(_c4, td.attr("field"));
            var _c6 = col.boxWidth + col.deltaWidth - 1;
            for (var i = 1; i < _c5; i++) {
                td = td.next();
                col = _74(_c4, td.attr("field"));
                _c6 += col.boxWidth + col.deltaWidth;
            }
            $(this).children("div.datagrid-cell")._outerWidth(_c6);
        });
    };
    function _c2(_c7) {
        var dc = $.data(_c7, "datagrid").dc;
        dc.view.find("div.datagrid-editable").each(function () {
            var _c8 = $(this);
            var _c9 = _c8.parent().attr("field");
            var col = $(_c7).datagrid("getColumnOption", _c9);
            _c8._outerWidth(col.boxWidth + col.deltaWidth - 1);
            var ed = $.data(this, "datagrid.editor");
            if (ed.actions.resize) {
                ed.actions.resize(ed.target, _c8.width());
            }
        });
    };
    function _74(_ca, _cb) {
        function _cc(_cd) {
            if (_cd) {
                for (var i = 0; i < _cd.length; i++) {
                    var cc = _cd[i];
                    for (var j = 0; j < cc.length; j++) {
                        var c = cc[j];
                        if (c.field == _cb) {
                            return c;
                        }
                    }
                }
            }
            return null;
        };
        var _ce = $.data(_ca, "datagrid").options;
        var col = _cc(_ce.columns);
        if (!col) {
            col = _cc(_ce.frozenColumns);
        }
        return col;
    };
    function _73(_cf, _d0) {
        var _d1 = $.data(_cf, "datagrid").options;
        var _d2 = (_d0 == true) ? (_d1.frozenColumns || [[]]) : _d1.columns;
        if (_d2.length == 0) {
            return [];
        }
        var aa = [];
        var _d3 = _d4();
        for (var i = 0; i < _d2.length; i++) {
            aa[i] = new Array(_d3);
        }
        for (var _d5 = 0; _d5 < _d2.length; _d5++) {
            $.map(_d2[_d5], function (col) {
                var _d6 = _d7(aa[_d5]);
                if (_d6 >= 0) {
                    var _d8 = col.field || "";
                    for (var c = 0; c < (col.colspan || 1) ; c++) {
                        for (var r = 0; r < (col.rowspan || 1) ; r++) {
                            aa[_d5 + r][_d6] = _d8;
                        }
                        _d6++;
                    }
                }
            });
        }
        return aa[aa.length - 1];
        function _d4() {
            var _d9 = 0;
            $.map(_d2[0], function (col) {
                _d9 += col.colspan || 1;
            });
            return _d9;
        };
        function _d7(a) {
            for (var i = 0; i < a.length; i++) {
                if (a[i] == undefined) {
                    return i;
                }
            }
            return -1;
        };
    };
    function _99(_da, _db) {
        var _dc = $.data(_da, "datagrid");
        var _dd = _dc.options;
        var dc = _dc.dc;
        _db = _dd.loadFilter.call(_da, _db);
        _db.total = parseInt(_db.total);
        _dc.data = _db;
        if (_db.footer) {
            _dc.footer = _db.footer;
        }
        if (!_dd.remoteSort && _dd.sortName) {
            var _de = _dd.sortName.split(",");
            var _df = _dd.sortOrder.split(",");
            _db.rows.sort(function (r1, r2) {
                var r = 0;
                for (var i = 0; i < _de.length; i++) {
                    var sn = _de[i];
                    var so = _df[i];
                    var col = _74(_da, sn);
                    var _e0 = col.sorter || function (a, b) {
                        return a == b ? 0 : (a > b ? 1 : -1);
                    };
                    r = _e0(r1[sn], r2[sn]) * (so == "asc" ? 1 : -1);
                    if (r != 0) {
                        return r;
                    }
                }
                return r;
            });
        }
        if (_dd.view.onBeforeRender) {
            _dd.view.onBeforeRender.call(_dd.view, _da, _db.rows);
        }
        _dd.view.render.call(_dd.view, _da, dc.body2, false);
        _dd.view.render.call(_dd.view, _da, dc.body1, true);
        if (_dd.showFooter) {
            _dd.view.renderFooter.call(_dd.view, _da, dc.footer2, false);
            _dd.view.renderFooter.call(_dd.view, _da, dc.footer1, true);
        }
        if (_dd.view.onAfterRender) {
            _dd.view.onAfterRender.call(_dd.view, _da);
        }
        _dc.ss.clean();
        var _e1 = $(_da).datagrid("getPager");
        if (_e1.length) {
            var _e2 = _e1.pagination("options");
            if (_e2.total != _db.total) {
                _e1.pagination("refresh", { total: _db.total });
                if (_dd.pageNumber != _e2.pageNumber) {
                    _dd.pageNumber = _e2.pageNumber;
                    _98(_da);
                }
            }
        }
        _36(_da);
        dc.body2.triggerHandler("scroll");
        $(_da).datagrid("setSelectionState");
        $(_da).datagrid("autoSizeColumn");
        _dd.onLoadSuccess.call(_da, _db);
    };
    function _e3(_e4) {
        var _e5 = $.data(_e4, "datagrid");
        var _e6 = _e5.options;
        var dc = _e5.dc;
        dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked", false);
        if (_e6.idField) {
            var _e7 = $.data(_e4, "treegrid") ? true : false;
            var _e8 = _e6.onSelect;
            var _e9 = _e6.onCheck;
            _e6.onSelect = _e6.onCheck = function () {
            };
            var _ea = _e6.finder.getRows(_e4);
            for (var i = 0; i < _ea.length; i++) {
                var row = _ea[i];
                var _eb = _e7 ? row[_e6.idField] : i;
                if (_ec(_e5.selectedRows, row)) {
                    _108(_e4, _eb, true);
                }
                if (_ec(_e5.checkedRows, row)) {
                    _10f(_e4, _eb, true);
                }
            }
            _e6.onSelect = _e8;
            _e6.onCheck = _e9;
        }
        function _ec(a, r) {
            for (var i = 0; i < a.length; i++) {
                if (a[i][_e6.idField] == r[_e6.idField]) {
                    a[i] = r;
                    return true;
                }
            }
            return false;
        };
    };
    function _ed(_ee, row) {
        var _ef = $.data(_ee, "datagrid");
        var _f0 = _ef.options;
        var _f1 = _ef.data.rows;
        if (typeof row == "object") {
            return _2(_f1, row);
        } else {
            for (var i = 0; i < _f1.length; i++) {
                if (_f1[i][_f0.idField] == row) {
                    return i;
                }
            }
            return -1;
        }
    };
    function _f2(_f3) {
        var _f4 = $.data(_f3, "datagrid");
        var _f5 = _f4.options;
        var _f6 = _f4.data;
        if (_f5.idField) {
            return _f4.selectedRows;
        } else {
            var _f7 = [];
            _f5.finder.getTr(_f3, "", "selected", 2).each(function () {
                _f7.push(_f5.finder.getRow(_f3, $(this)));
            });
            return _f7;
        }
    };
    function _f8(_f9) {
        var _fa = $.data(_f9, "datagrid");
        var _fb = _fa.options;
        if (_fb.idField) {
            return _fa.checkedRows;
        } else {
            var _fc = [];
            _fb.finder.getTr(_f9, "", "checked", 2).each(function () {
                _fc.push(_fb.finder.getRow(_f9, $(this)));
            });
            return _fc;
        }
    };
    function _fd(_fe, _ff) {
        var _100 = $.data(_fe, "datagrid");
        var dc = _100.dc;
        var opts = _100.options;
        var tr = opts.finder.getTr(_fe, _ff);
        if (tr.length) {
            if (tr.closest("table").hasClass("datagrid-btable-frozen")) {
                return;
            }
            var _101 = dc.view2.children("div.datagrid-header")._outerHeight();
            var _102 = dc.body2;
            var _103 = _102.outerHeight(true) - _102.outerHeight();
            var top = tr.position().top - _101 - _103;
            if (top < 0) {
                _102.scrollTop(_102.scrollTop() + top);
            } else {
                if (top + tr._outerHeight() > _102.height() - 18) {
                    _102.scrollTop(_102.scrollTop() + top + tr._outerHeight() - _102.height() + 18);
                }
            }
        }
    };
    function _104(_105, _106) {
        var _107 = $.data(_105, "datagrid");
        var opts = _107.options;
        opts.finder.getTr(_105, _107.highlightIndex).removeClass("datagrid-row-over");
        opts.finder.getTr(_105, _106).addClass("datagrid-row-over");
        _107.highlightIndex = _106;
    };
    function _108(_109, _10a, _10b) {
        var _10c = $.data(_109, "datagrid");
        var dc = _10c.dc;
        var opts = _10c.options;
        var _10d = _10c.selectedRows;
        if (opts.singleSelect) {
            _10e(_109);
            _10d.splice(0, _10d.length);
        }
        if (!_10b && opts.checkOnSelect) {
            _10f(_109, _10a, true);
        }
        var row = opts.finder.getRow(_109, _10a);
        if (opts.idField) {
            _7(_10d, opts.idField, row);
        }
        opts.finder.getTr(_109, _10a).addClass("datagrid-row-selected");
        opts.onSelect.call(_109, _10a, row);
        _fd(_109, _10a);
    };
    function _110(_111, _112, _113) {
        var _114 = $.data(_111, "datagrid");
        var dc = _114.dc;
        var opts = _114.options;
        var _115 = $.data(_111, "datagrid").selectedRows;
        if (!_113 && opts.checkOnSelect) {
            _116(_111, _112, true);
        }
        opts.finder.getTr(_111, _112).removeClass("datagrid-row-selected");
        var row = opts.finder.getRow(_111, _112);
        if (opts.idField) {
            _4(_115, opts.idField, row[opts.idField]);
        }
        opts.onUnselect.call(_111, _112, row);
    };
    function _117(_118, _119) {
        var _11a = $.data(_118, "datagrid");
        var opts = _11a.options;
        var rows = opts.finder.getRows(_118);
        var _11b = $.data(_118, "datagrid").selectedRows;
        if (!_119 && opts.checkOnSelect) {
            _11c(_118, true);
        }
        opts.finder.getTr(_118, "", "allbody").addClass("datagrid-row-selected");
        if (opts.idField) {
            for (var _11d = 0; _11d < rows.length; _11d++) {
                _7(_11b, opts.idField, rows[_11d]);
            }
        }
        opts.onSelectAll.call(_118, rows);
    };
    function _10e(_11e, _11f) {
        var _120 = $.data(_11e, "datagrid");
        var opts = _120.options;
        var rows = opts.finder.getRows(_11e);
        var _121 = $.data(_11e, "datagrid").selectedRows;
        if (!_11f && opts.checkOnSelect) {
            _122(_11e, true);
        }
        opts.finder.getTr(_11e, "", "selected").removeClass("datagrid-row-selected");
        if (opts.idField) {
            for (var _123 = 0; _123 < rows.length; _123++) {
                _4(_121, opts.idField, rows[_123][opts.idField]);
            }
        }
        opts.onUnselectAll.call(_11e, rows);
    };
    function _10f(_124, _125, _126) {
        var _127 = $.data(_124, "datagrid");
        var opts = _127.options;
        if (!_126 && opts.selectOnCheck) {
            _108(_124, _125, true);
        }
        var tr = opts.finder.getTr(_124, _125).addClass("datagrid-row-checked");
        var ck = tr.find("div.datagrid-cell-check input[type=checkbox]");
        ck._propAttr("checked", true);
        tr = opts.finder.getTr(_124, "", "checked", 2);
        if (tr.length == opts.finder.getRows(_124).length) {
            var dc = _127.dc;
            var _128 = dc.header1.add(dc.header2);
            _128.find("input[type=checkbox]")._propAttr("checked", true);
        }
        var row = opts.finder.getRow(_124, _125);
        if (opts.idField) {
            _7(_127.checkedRows, opts.idField, row);
        }
        opts.onCheck.call(_124, _125, row);
    };
    function _116(_129, _12a, _12b) {
        var _12c = $.data(_129, "datagrid");
        var opts = _12c.options;
        if (!_12b && opts.selectOnCheck) {
            _110(_129, _12a, true);
        }
        var tr = opts.finder.getTr(_129, _12a).removeClass("datagrid-row-checked");
        var ck = tr.find("div.datagrid-cell-check input[type=checkbox]");
        ck._propAttr("checked", false);
        var dc = _12c.dc;
        var _12d = dc.header1.add(dc.header2);
        _12d.find("input[type=checkbox]")._propAttr("checked", false);
        var row = opts.finder.getRow(_129, _12a);
        if (opts.idField) {
            _4(_12c.checkedRows, opts.idField, row[opts.idField]);
        }
        opts.onUncheck.call(_129, _12a, row);
    };
    function _11c(_12e, _12f) {
        var _130 = $.data(_12e, "datagrid");
        var opts = _130.options;
        var rows = opts.finder.getRows(_12e);
        if (!_12f && opts.selectOnCheck) {
            _117(_12e, true);
        }
        var dc = _130.dc;
        var hck = dc.header1.add(dc.header2).find("input[type=checkbox]");
        var bck = opts.finder.getTr(_12e, "", "allbody").addClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]");
        hck.add(bck)._propAttr("checked", true);
        if (opts.idField) {
            for (var i = 0; i < rows.length; i++) {
                _7(_130.checkedRows, opts.idField, rows[i]);
            }
        }
        opts.onCheckAll.call(_12e, rows);
    };
    function _122(_131, _132) {
        var _133 = $.data(_131, "datagrid");
        var opts = _133.options;
        var rows = opts.finder.getRows(_131);
        if (!_132 && opts.selectOnCheck) {
            _10e(_131, true);
        }
        var dc = _133.dc;
        var hck = dc.header1.add(dc.header2).find("input[type=checkbox]");
        var bck = opts.finder.getTr(_131, "", "checked").removeClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]");
        hck.add(bck)._propAttr("checked", false);
        if (opts.idField) {
            for (var i = 0; i < rows.length; i++) {
                _4(_133.checkedRows, opts.idField, rows[i][opts.idField]);
            }
        }
        opts.onUncheckAll.call(_131, rows);
    };
    function _134(_135, _136) {
        var opts = $.data(_135, "datagrid").options;
        var tr = opts.finder.getTr(_135, _136);
        var row = opts.finder.getRow(_135, _136);
        if (tr.hasClass("datagrid-row-editing")) {
            return;
        }
        if (opts.onBeforeEdit.call(_135, _136, row) == false) {
            return;
        }
        tr.addClass("datagrid-row-editing");
        _137(_135, _136);
        _c2(_135);
        tr.find("div.datagrid-editable").each(function () {
            var _138 = $(this).parent().attr("field");
            var ed = $.data(this, "datagrid.editor");
            ed.actions.setValue(ed.target, row[_138]);
        });
        _139(_135, _136);
        opts.onBeginEdit.call(_135, _136, row);
    };
    function _13a(_13b, _13c, _13d) {
        var _13e = $.data(_13b, "datagrid");
        var opts = _13e.options;
        var _13f = _13e.updatedRows;
        var _140 = _13e.insertedRows;
        var tr = opts.finder.getTr(_13b, _13c);
        var row = opts.finder.getRow(_13b, _13c);
        if (!tr.hasClass("datagrid-row-editing")) {
            return;
        }
        if (!_13d) {
            if (!_139(_13b, _13c)) {
                return;
            }
            var _141 = false;
            var _142 = {};
            tr.find("div.datagrid-editable").each(function () {
                var _143 = $(this).parent().attr("field");
                var ed = $.data(this, "datagrid.editor");
                var _144 = ed.actions.getValue(ed.target);
                if (row[_143] != _144) {
                    row[_143] = _144;
                    _141 = true;
                    _142[_143] = _144;
                }
            });
            if (_141) {
                if (_2(_140, row) == -1) {
                    if (_2(_13f, row) == -1) {
                        _13f.push(row);
                    }
                }
            }
            opts.onEndEdit.call(_13b, _13c, row, _142);
        }
        tr.removeClass("datagrid-row-editing");
        _145(_13b, _13c);
        $(_13b).datagrid("refreshRow", _13c);
        if (!_13d) {
            opts.onAfterEdit.call(_13b, _13c, row, _142);
        } else {
            opts.onCancelEdit.call(_13b, _13c, row);
        }
    };
    function _146(_147, _148) {
        var opts = $.data(_147, "datagrid").options;
        var tr = opts.finder.getTr(_147, _148);
        var _149 = [];
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-editable");
            if (cell.length) {
                var ed = $.data(cell[0], "datagrid.editor");
                _149.push(ed);
            }
        });
        return _149;
    };
    function _14a(_14b, _14c) {
        var _14d = _146(_14b, _14c.index != undefined ? _14c.index : _14c.id);
        for (var i = 0; i < _14d.length; i++) {
            if (_14d[i].field == _14c.field) {
                return _14d[i];
            }
        }
        return null;
    };
    function _137(_14e, _14f) {
        var opts = $.data(_14e, "datagrid").options;
        var tr = opts.finder.getTr(_14e, _14f);
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-cell");
            var _150 = $(this).attr("field");
            var col = _74(_14e, _150);
            if (col && col.editor) {
                var _151, _152;
                if (typeof col.editor == "string") {
                    _151 = col.editor;
                } else {
                    _151 = col.editor.type;
                    _152 = col.editor.options;
                }
                var _153 = opts.editors[_151];
                if (_153) {
                    var _154 = cell.html();
                    var _155 = cell._outerWidth();
                    cell.addClass("datagrid-editable");
                    cell._outerWidth(_155);
                    cell.html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td></td></tr></table>");
                    cell.children("table").bind("click dblclick contextmenu", function (e) {
                        e.stopPropagation();
                    });
                    $.data(cell[0], "datagrid.editor", { actions: _153, target: _153.init(cell.find("td"), _152), field: _150, type: _151, oldHtml: _154 });
                }
            }
        });
        _36(_14e, _14f, true);
    };
    function _145(_156, _157) {
        var opts = $.data(_156, "datagrid").options;
        var tr = opts.finder.getTr(_156, _157);
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-editable");
            if (cell.length) {
                var ed = $.data(cell[0], "datagrid.editor");
                if (ed.actions.destroy) {
                    ed.actions.destroy(ed.target);
                }
                cell.html(ed.oldHtml);
                $.removeData(cell[0], "datagrid.editor");
                cell.removeClass("datagrid-editable");
                cell.css("width", "");
            }
        });
    };
    function _139(_158, _159) {
        var tr = $.data(_158, "datagrid").options.finder.getTr(_158, _159);
        if (!tr.hasClass("datagrid-row-editing")) {
            return true;
        }
        var vbox = tr.find(".validatebox-text");
        vbox.validatebox("validate");
        vbox.trigger("mouseleave");
        var _15a = tr.find(".validatebox-invalid");
        return _15a.length == 0;
    };
    function _15b(_15c, _15d) {
        var _15e = $.data(_15c, "datagrid").insertedRows;
        var _15f = $.data(_15c, "datagrid").deletedRows;
        var _160 = $.data(_15c, "datagrid").updatedRows;
        if (!_15d) {
            var rows = [];
            rows = rows.concat(_15e);
            rows = rows.concat(_15f);
            rows = rows.concat(_160);
            return rows;
        } else {
            if (_15d == "inserted") {
                return _15e;
            } else {
                if (_15d == "deleted") {
                    return _15f;
                } else {
                    if (_15d == "updated") {
                        return _160;
                    }
                }
            }
        }
        return [];
    };
    function _161(_162, _163) {
        var _164 = $.data(_162, "datagrid");
        var opts = _164.options;
        var data = _164.data;
        var _165 = _164.insertedRows;
        var _166 = _164.deletedRows;
        $(_162).datagrid("cancelEdit", _163);
        var row = opts.finder.getRow(_162, _163);
        if (_2(_165, row) >= 0) {
            _4(_165, row);
        } else {
            _166.push(row);
        }
        _4(_164.selectedRows, opts.idField, row[opts.idField]);
        _4(_164.checkedRows, opts.idField, row[opts.idField]);
        opts.view.deleteRow.call(opts.view, _162, _163);
        if (opts.height == "auto") {
            _36(_162);
        }
        $(_162).datagrid("getPager").pagination("refresh", { total: data.total });
    };
    function _167(_168, _169) {
        var data = $.data(_168, "datagrid").data;
        var view = $.data(_168, "datagrid").options.view;
        var _16a = $.data(_168, "datagrid").insertedRows;
        view.insertRow.call(view, _168, _169.index, _169.row);
        _16a.push(_169.row);
        $(_168).datagrid("getPager").pagination("refresh", { total: data.total });
    };
    function _16b(_16c, row) {
        var data = $.data(_16c, "datagrid").data;
        var view = $.data(_16c, "datagrid").options.view;
        var _16d = $.data(_16c, "datagrid").insertedRows;
        view.insertRow.call(view, _16c, null, row);
        _16d.push(row);
        $(_16c).datagrid("getPager").pagination("refresh", { total: data.total });
    };
    function _16e(_16f) {
        var _170 = $.data(_16f, "datagrid");
        var data = _170.data;
        var rows = data.rows;
        var _171 = [];
        for (var i = 0; i < rows.length; i++) {
            _171.push($.extend({}, rows[i]));
        }
        _170.originalRows = _171;
        _170.updatedRows = [];
        _170.insertedRows = [];
        _170.deletedRows = [];
    };
    function _172(_173) {
        var data = $.data(_173, "datagrid").data;
        var ok = true;
        for (var i = 0, len = data.rows.length; i < len; i++) {
            if (_139(_173, i)) {
                $(_173).datagrid("endEdit", i);
            } else {
                ok = false;
            }
        }
        if (ok) {
            _16e(_173);
        }
    };
    function _174(_175) {
        var _176 = $.data(_175, "datagrid");
        var opts = _176.options;
        var _177 = _176.originalRows;
        var _178 = _176.insertedRows;
        var _179 = _176.deletedRows;
        var _17a = _176.selectedRows;
        var _17b = _176.checkedRows;
        var data = _176.data;
        function _17c(a) {
            var ids = [];
            for (var i = 0; i < a.length; i++) {
                ids.push(a[i][opts.idField]);
            }
            return ids;
        };
        function _17d(ids, _17e) {
            for (var i = 0; i < ids.length; i++) {
                var _17f = _ed(_175, ids[i]);
                if (_17f >= 0) {
                    (_17e == "s" ? _108 : _10f)(_175, _17f, true);
                }
            }
        };
        for (var i = 0; i < data.rows.length; i++) {
            $(_175).datagrid("cancelEdit", i);
        }
        var _180 = _17c(_17a);
        var _181 = _17c(_17b);
        _17a.splice(0, _17a.length);
        _17b.splice(0, _17b.length);
        data.total += _179.length - _178.length;
        data.rows = _177;
        _99(_175, data);
        _17d(_180, "s");
        _17d(_181, "c");
        _16e(_175);
    };
    function _98(_182, _183) {
        var opts = $.data(_182, "datagrid").options;
        if (_183) {
            opts.queryParams = _183;
        }
        var _184 = $.extend({}, opts.queryParams);
        if (opts.pagination) {
            $.extend(_184, { page: opts.pageNumber, rows: opts.pageSize });
        }
        if (opts.sortName) {
            $.extend(_184, { sort: opts.sortName, order: opts.sortOrder });
        }
        if (opts.onBeforeLoad.call(_182, _184) == false) {
            return;
        }
        $(_182).datagrid("loading");
        setTimeout(function () {
            _185();
        }, 0);
        function _185() {
            var _186 = opts.loader.call(_182, _184, function (data) {
                setTimeout(function () {
                    $(_182).datagrid("loaded");
                }, 0);
                _99(_182, data);
                setTimeout(function () {
                    _16e(_182);
                }, 0);
            }, function () {
                setTimeout(function () {
                    $(_182).datagrid("loaded");
                }, 0);
                opts.onLoadError.apply(_182, arguments);
            });
            if (_186 == false) {
                $(_182).datagrid("loaded");
            }
        };
    };
    function _187(_188, _189) {
        var opts = $.data(_188, "datagrid").options;
        _189.type = _189.type || "body";
        _189.rowspan = _189.rowspan || 1;
        _189.colspan = _189.colspan || 1;
        if (_189.rowspan == 1 && _189.colspan == 1) {
            return;
        }
        var tr = opts.finder.getTr(_188, (_189.index != undefined ? _189.index : _189.id), _189.type);
        if (!tr.length) {
            return;
        }
        var td = tr.find("td[field=\"" + _189.field + "\"]");
        td.attr("rowspan", _189.rowspan).attr("colspan", _189.colspan);
        td.addClass("datagrid-td-merged");
        _18a(td.next(), _189.colspan - 1);
        for (var i = 1; i < _189.rowspan; i++) {
            tr = tr.next();
            if (!tr.length) {
                break;
            }
            td = tr.find("td[field=\"" + _189.field + "\"]");
            _18a(td, _189.colspan);
        }
        _c1(_188);
        function _18a(td, _18b) {
            for (var i = 0; i < _18b; i++) {
                td.hide();
                td = td.next();
            }
        };
    };
    $.fn.datagrid = function (_18c, _18d) {
        if (typeof _18c == "string") {
            return $.fn.datagrid.methods[_18c](this, _18d);
        }
        _18c = _18c || {};
        return this.each(function () {
            var _18e = $.data(this, "datagrid");
            var opts;
            if (_18e) {
                opts = $.extend(_18e.options, _18c);
                _18e.options = opts;
            } else {
                opts = $.extend({}, $.extend({}, $.fn.datagrid.defaults, { queryParams: {} }), $.fn.datagrid.parseOptions(this), _18c);
                $(this).css("width", "").css("height", "");
                var _18f = _4f(this, opts.rownumbers);
                if (!opts.columns) {
                    opts.columns = _18f.columns;
                }
                if (!opts.frozenColumns) {
                    opts.frozenColumns = _18f.frozenColumns;
                }
                opts.columns = $.extend(true, [], opts.columns);
                opts.frozenColumns = $.extend(true, [], opts.frozenColumns);
                opts.view = $.extend({}, opts.view);
                $.data(this, "datagrid", { options: opts, panel: _18f.panel, dc: _18f.dc, ss: null, selectedRows: [], checkedRows: [], data: { total: 0, rows: [] }, originalRows: [], updatedRows: [], insertedRows: [], deletedRows: [] });
            }
            _5a(this);
            _75(this);
            _1c(this);
            if (opts.data) {
                _99(this, opts.data);
                _16e(this);
            } else {
                var data = $.fn.datagrid.parseData(this);
                if (data.total > 0) {
                    _99(this, data);
                    _16e(this);
                }
            }
            _98(this);
        });
    };
    function _190(_191) {
        var _192 = {};
        $.map(_191, function (name) {
            _192[name] = _193(name);
        });
        return _192;
        function _193(name) {
            function isA(_194) {
                return $.data($(_194)[0], name) != undefined;
            };
            return {
                init: function (_195, _196) {
                    var _197 = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_195);
                    if (_197[name] && name != "text") {
                        return _197[name](_196);
                    } else {
                        return _197;
                    }
                }, destroy: function (_198) {
                    if (isA(_198, name)) {
                        $(_198)[name]("destroy");
                    }
                }, getValue: function (_199) {
                    if (isA(_199, name)) {
                        var opts = $(_199)[name]("options");
                        if (opts.multiple) {
                            return $(_199)[name]("getValues").join(opts.separator);
                        } else {
                            return $(_199)[name]("getValue");
                        }
                    } else {
                        return $(_199).val();
                    }
                }, setValue: function (_19a, _19b) {
                    if (isA(_19a, name)) {
                        var opts = $(_19a)[name]("options");
                        if (opts.multiple) {
                            if (_19b) {
                                $(_19a)[name]("setValues", _19b.split(opts.separator));
                            } else {
                                $(_19a)[name]("clear");
                            }
                        } else {
                            $(_19a)[name]("setValue", _19b);
                        }
                    } else {
                        $(_19a).val(_19b);
                    }
                }, resize: function (_19c, _19d) {
                    if (isA(_19c, name)) {
                        $(_19c)[name]("resize", _19d);
                    } else {
                        $(_19c)._outerWidth(_19d)._outerHeight(22);
                    }
                }
            };
        };
    };
    var _19e = $.extend({}, _190(["text", "textbox", "numberbox", "numberspinner", "combobox", "combotree", "combogrid", "datebox", "datetimebox", "timespinner", "datetimespinner"]), {
        textarea: {
            init: function (_19f, _1a0) {
                var _1a1 = $("<textarea class=\"datagrid-editable-input\"></textarea>").appendTo(_19f);
                return _1a1;
            }, getValue: function (_1a2) {
                return $(_1a2).val();
            }, setValue: function (_1a3, _1a4) {
                $(_1a3).val(_1a4);
            }, resize: function (_1a5, _1a6) {
                $(_1a5)._outerWidth(_1a6);
            }
        }, checkbox: {
            init: function (_1a7, _1a8) {
                var _1a9 = $("<input type=\"checkbox\">").appendTo(_1a7);
                _1a9.val(_1a8.on);
                _1a9.attr("offval", _1a8.off);
                return _1a9;
            }, getValue: function (_1aa) {
                if ($(_1aa).is(":checked")) {
                    return $(_1aa).val();
                } else {
                    return $(_1aa).attr("offval");
                }
            }, setValue: function (_1ab, _1ac) {
                var _1ad = false;
                if ($(_1ab).val() == _1ac) {
                    _1ad = true;
                }
                $(_1ab)._propAttr("checked", _1ad);
            }
        }, validatebox: {
            init: function (_1ae, _1af) {
                var _1b0 = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_1ae);
                _1b0.validatebox(_1af);
                return _1b0;
            }, destroy: function (_1b1) {
                $(_1b1).validatebox("destroy");
            }, getValue: function (_1b2) {
                return $(_1b2).val();
            }, setValue: function (_1b3, _1b4) {
                $(_1b3).val(_1b4);
            }, resize: function (_1b5, _1b6) {
                $(_1b5)._outerWidth(_1b6)._outerHeight(22);
            }
        }
    });
    $.fn.datagrid.methods = {
        options: function (jq) {
            var _1b7 = $.data(jq[0], "datagrid").options;
            var _1b8 = $.data(jq[0], "datagrid").panel.panel("options");
            var opts = $.extend(_1b7, { width: _1b8.width, height: _1b8.height, closed: _1b8.closed, collapsed: _1b8.collapsed, minimized: _1b8.minimized, maximized: _1b8.maximized });
            return opts;
        }, setSelectionState: function (jq) {
            return jq.each(function () {
                _e3(this);
            });
        }, createStyleSheet: function (jq) {
            return _9(jq[0]);
        }, getPanel: function (jq) {
            return $.data(jq[0], "datagrid").panel;
        }, getPager: function (jq) {
            return $.data(jq[0], "datagrid").panel.children("div.datagrid-pager");
        }, getColumnFields: function (jq, _1b9) {
            return _73(jq[0], _1b9);
        }, getColumnOption: function (jq, _1ba) {
            return _74(jq[0], _1ba);
        }, resize: function (jq, _1bb) {
            return jq.each(function () {
                _1c(this, _1bb);
            });
        }, load: function (jq, _1bc) {
            return jq.each(function () {
                var opts = $(this).datagrid("options");
                if (typeof _1bc == "string") {
                    opts.url = _1bc;
                    _1bc = null;
                }
                opts.pageNumber = 1;
                var _1bd = $(this).datagrid("getPager");
                _1bd.pagination("refresh", { pageNumber: 1 });
                _98(this, _1bc);
            });
        }, reload: function (jq, _1be) {
            return jq.each(function () {
                var opts = $(this).datagrid("options");
                if (typeof _1be == "string") {
                    opts.url = _1be;
                    _1be = null;
                }
                _98(this, _1be);
            });
        }, reloadFooter: function (jq, _1bf) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                var dc = $.data(this, "datagrid").dc;
                if (_1bf) {
                    $.data(this, "datagrid").footer = _1bf;
                }
                if (opts.showFooter) {
                    opts.view.renderFooter.call(opts.view, this, dc.footer2, false);
                    opts.view.renderFooter.call(opts.view, this, dc.footer1, true);
                    if (opts.view.onAfterRender) {
                        opts.view.onAfterRender.call(opts.view, this);
                    }
                    $(this).datagrid("fixRowHeight");
                }
            });
        }, loading: function (jq) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                $(this).datagrid("getPager").pagination("loading");
                if (opts.loadMsg) {
                    var _1c0 = $(this).datagrid("getPanel");
                    if (!_1c0.children("div.datagrid-mask").length) {
                        $("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo(_1c0);
                        var msg = $("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(opts.loadMsg).appendTo(_1c0);
                        msg._outerHeight(40);
                        msg.css({ marginLeft: (-msg.outerWidth() / 2), lineHeight: (msg.height() + "px") });
                    }
                }
            });
        }, loaded: function (jq) {
            return jq.each(function () {
                $(this).datagrid("getPager").pagination("loaded");
                var _1c1 = $(this).datagrid("getPanel");
                _1c1.children("div.datagrid-mask-msg").remove();
                _1c1.children("div.datagrid-mask").remove();
            });
        }, fitColumns: function (jq) {
            return jq.each(function () {
                _9a(this);
            });
        }, fixColumnSize: function (jq, _1c2) {
            return jq.each(function () {
                _bb(this, _1c2);
            });
        }, fixRowHeight: function (jq, _1c3) {
            return jq.each(function () {
                _36(this, _1c3);
            });
        }, freezeRow: function (jq, _1c4) {
            return jq.each(function () {
                _47(this, _1c4);
            });
        }, autoSizeColumn: function (jq, _1c5) {
            return jq.each(function () {
                _ac(this, _1c5);
            });
        }, loadData: function (jq, data) {
            return jq.each(function () {
                _99(this, data);
                _16e(this);
            });
        }, getData: function (jq) {
            return $.data(jq[0], "datagrid").data;
        }, getRows: function (jq) {
            return $.data(jq[0], "datagrid").data.rows;
        }, getFooterRows: function (jq) {
            return $.data(jq[0], "datagrid").footer;
        }, getRowIndex: function (jq, id) {
            return _ed(jq[0], id);
        }, getChecked: function (jq) {
            return _f8(jq[0]);
        }, getSelected: function (jq) {
            var rows = _f2(jq[0]);
            return rows.length > 0 ? rows[0] : null;
        }, getSelections: function (jq) {
            return _f2(jq[0]);
        }, clearSelections: function (jq) {
            return jq.each(function () {
                var _1c6 = $.data(this, "datagrid");
                var _1c7 = _1c6.selectedRows;
                var _1c8 = _1c6.checkedRows;
                _1c7.splice(0, _1c7.length);
                _10e(this);
                if (_1c6.options.checkOnSelect) {
                    _1c8.splice(0, _1c8.length);
                }
            });
        }, clearChecked: function (jq) {
            return jq.each(function () {
                var _1c9 = $.data(this, "datagrid");
                var _1ca = _1c9.selectedRows;
                var _1cb = _1c9.checkedRows;
                _1cb.splice(0, _1cb.length);
                _122(this);
                if (_1c9.options.selectOnCheck) {
                    _1ca.splice(0, _1ca.length);
                }
            });
        }, scrollTo: function (jq, _1cc) {
            return jq.each(function () {
                _fd(this, _1cc);
            });
        }, highlightRow: function (jq, _1cd) {
            return jq.each(function () {
                _104(this, _1cd);
                _fd(this, _1cd);
            });
        }, selectAll: function (jq) {
            return jq.each(function () {
                _117(this);
            });
        }, unselectAll: function (jq) {
            return jq.each(function () {
                _10e(this);
            });
        }, selectRow: function (jq, _1ce) {
            return jq.each(function () {
                _108(this, _1ce);
            });
        }, selectRecord: function (jq, id) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                if (opts.idField) {
                    var _1cf = _ed(this, id);
                    if (_1cf >= 0) {
                        $(this).datagrid("selectRow", _1cf);
                    }
                }
            });
        }, unselectRow: function (jq, _1d0) {
            return jq.each(function () {
                _110(this, _1d0);
            });
        }, checkRow: function (jq, _1d1) {
            return jq.each(function () {
                _10f(this, _1d1);
            });
        }, uncheckRow: function (jq, _1d2) {
            return jq.each(function () {
                _116(this, _1d2);
            });
        }, checkAll: function (jq) {
            return jq.each(function () {
                _11c(this);
            });
        }, uncheckAll: function (jq) {
            return jq.each(function () {
                _122(this);
            });
        }, beginEdit: function (jq, _1d3) {
            return jq.each(function () {
                _134(this, _1d3);
            });
        }, endEdit: function (jq, _1d4) {
            return jq.each(function () {
                _13a(this, _1d4, false);
            });
        }, cancelEdit: function (jq, _1d5) {
            return jq.each(function () {
                _13a(this, _1d5, true);
            });
        }, getEditors: function (jq, _1d6) {
            return _146(jq[0], _1d6);
        }, getEditor: function (jq, _1d7) {
            return _14a(jq[0], _1d7);
        }, refreshRow: function (jq, _1d8) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                opts.view.refreshRow.call(opts.view, this, _1d8);
            });
        }, validateRow: function (jq, _1d9) {
            return _139(jq[0], _1d9);
        }, updateRow: function (jq, _1da) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                opts.view.updateRow.call(opts.view, this, _1da.index, _1da.row);
            });
        }, appendRow: function (jq, row) {
            return jq.each(function () {
                _16b(this, row);
            });
        }, insertRow: function (jq, _1db) {
            return jq.each(function () {
                _167(this, _1db);
            });
        }, deleteRow: function (jq, _1dc) {
            return jq.each(function () {
                _161(this, _1dc);
            });
        }, getChanges: function (jq, _1dd) {
            return _15b(jq[0], _1dd);
        }, acceptChanges: function (jq) {
            return jq.each(function () {
                _172(this);
            });
        }, rejectChanges: function (jq) {
            return jq.each(function () {
                _174(this);
            });
        }, mergeCells: function (jq, _1de) {
            return jq.each(function () {
                _187(this, _1de);
            });
        }, showColumn: function (jq, _1df) {
            return jq.each(function () {
                var _1e0 = $(this).datagrid("getPanel");
                _1e0.find("td[field=\"" + _1df + "\"]").show();
                $(this).datagrid("getColumnOption", _1df).hidden = false;
                $(this).datagrid("fitColumns");
            });
        }, hideColumn: function (jq, _1e1) {
            return jq.each(function () {
                var _1e2 = $(this).datagrid("getPanel");
                _1e2.find("td[field=\"" + _1e1 + "\"]").hide();
                $(this).datagrid("getColumnOption", _1e1).hidden = true;
                $(this).datagrid("fitColumns");
            });
        }, sort: function (jq, _1e3) {
            return jq.each(function () {
                _8c(this, _1e3);
            });
        }
    };
    $.fn.datagrid.parseOptions = function (_1e4) {
        var t = $(_1e4);
        return $.extend({}, $.fn.panel.parseOptions(_1e4), $.parser.parseOptions(_1e4, ["url", "toolbar", "idField", "sortName", "sortOrder", "pagePosition", "resizeHandle", { sharedStyleSheet: "boolean", fitColumns: "boolean", autoRowHeight: "boolean", striped: "boolean", nowrap: "boolean" }, { rownumbers: "boolean", singleSelect: "boolean", ctrlSelect: "boolean", checkOnSelect: "boolean", selectOnCheck: "boolean" }, { pagination: "boolean", pageSize: "number", pageNumber: "number" }, { multiSort: "boolean", remoteSort: "boolean", showHeader: "boolean", showFooter: "boolean" }, { scrollbarSize: "number" }]), { pageList: (t.attr("pageList") ? eval(t.attr("pageList")) : undefined), loadMsg: (t.attr("loadMsg") != undefined ? t.attr("loadMsg") : undefined), rowStyler: (t.attr("rowStyler") ? eval(t.attr("rowStyler")) : undefined) });
    };
    $.fn.datagrid.parseData = function (_1e5) {
        var t = $(_1e5);
        var data = { total: 0, rows: [] };
        var _1e6 = t.datagrid("getColumnFields", true).concat(t.datagrid("getColumnFields", false));
        t.find("tbody tr").each(function () {
            data.total++;
            var row = {};
            $.extend(row, $.parser.parseOptions(this, ["iconCls", "state"]));
            for (var i = 0; i < _1e6.length; i++) {
                row[_1e6[i]] = $(this).find("td:eq(" + i + ")").html();
            }
            data.rows.push(row);
        });
        return data;
    };
    var _1e7 = {
        render: function (_1e8, _1e9, _1ea) {
            var _1eb = $.data(_1e8, "datagrid");
            var opts = _1eb.options;
            var rows = _1eb.data.rows;
            var _1ec = $(_1e8).datagrid("getColumnFields", _1ea);
            if (_1ea) {
                if (!(opts.rownumbers || (opts.frozenColumns && opts.frozenColumns.length))) {
                    return;
                }
            }
            var _1ed = ["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
            for (var i = 0; i < rows.length; i++) {
                var css = opts.rowStyler ? opts.rowStyler.call(_1e8, i, rows[i]) : "";
                var _1ee = "";
                var _1ef = "";
                if (typeof css == "string") {
                    _1ef = css;
                } else {
                    if (css) {
                        _1ee = css["class"] || "";
                        _1ef = css["style"] || "";
                    }
                }
                var cls = "class=\"datagrid-row " + (i % 2 && opts.striped ? "datagrid-row-alt " : " ") + _1ee + "\"";
                var _1f0 = _1ef ? "style=\"" + _1ef + "\"" : "";
                var _1f1 = _1eb.rowIdPrefix + "-" + (_1ea ? 1 : 2) + "-" + i;
                _1ed.push("<tr id=\"" + _1f1 + "\" datagrid-row-index=\"" + i + "\" " + cls + " " + _1f0 + ">");
                _1ed.push(this.renderRow.call(this, _1e8, _1ec, _1ea, i, rows[i]));
                _1ed.push("</tr>");
            }
            _1ed.push("</tbody></table>");
            $(_1e9).html(_1ed.join(""));
        }, renderFooter: function (_1f2, _1f3, _1f4) {
            var opts = $.data(_1f2, "datagrid").options;
            var rows = $.data(_1f2, "datagrid").footer || [];
            var _1f5 = $(_1f2).datagrid("getColumnFields", _1f4);
            var _1f6 = ["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
            for (var i = 0; i < rows.length; i++) {
                _1f6.push("<tr class=\"datagrid-row\" datagrid-row-index=\"" + i + "\">");
                _1f6.push(this.renderRow.call(this, _1f2, _1f5, _1f4, i, rows[i]));
                _1f6.push("</tr>");
            }
            _1f6.push("</tbody></table>");
            $(_1f3).html(_1f6.join(""));
        }, renderRow: function (_1f7, _1f8, _1f9, _1fa, _1fb) {
            var opts = $.data(_1f7, "datagrid").options;
            var cc = [];
            if (_1f9 && opts.rownumbers) {
                var _1fc = _1fa + 1;
                if (opts.pagination) {
                    _1fc += (opts.pageNumber - 1) * opts.pageSize;
                }
                cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">" + _1fc + "</div></td>");
            }
            for (var i = 0; i < _1f8.length; i++) {
                var _1fd = _1f8[i];
                var col = $(_1f7).datagrid("getColumnOption", _1fd);
                if (col) {
                    var _1fe = _1fb[_1fd];
                    var css = col.styler ? (col.styler(_1fe, _1fb, _1fa) || "") : "";
                    var _1ff = "";
                    var _200 = "";
                    if (typeof css == "string") {
                        _200 = css;
                    } else {
                        if (css) {
                            _1ff = css["class"] || "";
                            _200 = css["style"] || "";
                        }
                    }
                    var cls = _1ff ? "class=\"" + _1ff + "\"" : "";
                    var _201 = col.hidden ? "style=\"display:none;" + _200 + "\"" : (_200 ? "style=\"" + _200 + "\"" : "");
                    cc.push("<td field=\"" + _1fd + "\" " + cls + " " + _201 + ">");
                    var _201 = "";
                    if (!col.checkbox) {
                        if (col.align) {
                            _201 += "text-align:" + col.align + ";";
                        }
                        if (!opts.nowrap) {
                            _201 += "white-space:normal;height:auto;";
                        } else {
                            if (opts.autoRowHeight) {
                                _201 += "height:auto;";
                            }
                        }
                    }
                    cc.push("<div style=\"" + _201 + "\" ");
                    cc.push(col.checkbox ? "class=\"datagrid-cell-check\"" : "class=\"datagrid-cell " + col.cellClass + "\"");
                    cc.push(">");
                    if (col.checkbox) {
                        cc.push("<input type=\"checkbox\" " + (_1fb.checked ? "checked=\"checked\"" : ""));
                        cc.push(" name=\"" + _1fd + "\" value=\"" + (_1fe != undefined ? _1fe : "") + "\">");
                    } else {
                        if (col.formatter) {
                            cc.push(col.formatter(_1fe, _1fb, _1fa));
                        } else {
                            cc.push(_1fe);
                        }
                    }
                    cc.push("</div>");
                    cc.push("</td>");
                }
            }
            return cc.join("");
        }, refreshRow: function (_202, _203) {
            this.updateRow.call(this, _202, _203, {});
        }, updateRow: function (_204, _205, row) {
            var opts = $.data(_204, "datagrid").options;
            var rows = $(_204).datagrid("getRows");
            $.extend(rows[_205], row);
            var css = opts.rowStyler ? opts.rowStyler.call(_204, _205, rows[_205]) : "";
            var _206 = "";
            var _207 = "";
            if (typeof css == "string") {
                _207 = css;
            } else {
                if (css) {
                    _206 = css["class"] || "";
                    _207 = css["style"] || "";
                }
            }
            var _206 = "datagrid-row " + (_205 % 2 && opts.striped ? "datagrid-row-alt " : " ") + _206;
            function _208(_209) {
                var _20a = $(_204).datagrid("getColumnFields", _209);
                var tr = opts.finder.getTr(_204, _205, "body", (_209 ? 1 : 2));
                var _20b = tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
                tr.html(this.renderRow.call(this, _204, _20a, _209, _205, rows[_205]));
                tr.attr("style", _207).attr("class", tr.hasClass("datagrid-row-selected") ? _206 + " datagrid-row-selected" : _206);
                if (_20b) {
                    tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true);
                }
            };
            _208.call(this, true);
            _208.call(this, false);
            $(_204).datagrid("fixRowHeight", _205);
        }, insertRow: function (_20c, _20d, row) {
            var _20e = $.data(_20c, "datagrid");
            var opts = _20e.options;
            var dc = _20e.dc;
            var data = _20e.data;
            if (_20d == undefined || _20d == null) {
                _20d = data.rows.length;
            }
            if (_20d > data.rows.length) {
                _20d = data.rows.length;
            }
            function _20f(_210) {
                var _211 = _210 ? 1 : 2;
                for (var i = data.rows.length - 1; i >= _20d; i--) {
                    var tr = opts.finder.getTr(_20c, i, "body", _211);
                    tr.attr("datagrid-row-index", i + 1);
                    tr.attr("id", _20e.rowIdPrefix + "-" + _211 + "-" + (i + 1));
                    if (_210 && opts.rownumbers) {
                        var _212 = i + 2;
                        if (opts.pagination) {
                            _212 += (opts.pageNumber - 1) * opts.pageSize;
                        }
                        tr.find("div.datagrid-cell-rownumber").html(_212);
                    }
                    if (opts.striped) {
                        tr.removeClass("datagrid-row-alt").addClass((i + 1) % 2 ? "datagrid-row-alt" : "");
                    }
                }
            };
            function _213(_214) {
                var _215 = _214 ? 1 : 2;
                var _216 = $(_20c).datagrid("getColumnFields", _214);
                var _217 = _20e.rowIdPrefix + "-" + _215 + "-" + _20d;
                var tr = "<tr id=\"" + _217 + "\" class=\"datagrid-row\" datagrid-row-index=\"" + _20d + "\"></tr>";
                if (_20d >= data.rows.length) {
                    if (data.rows.length) {
                        opts.finder.getTr(_20c, "", "last", _215).after(tr);
                    } else {
                        var cc = _214 ? dc.body1 : dc.body2;
                        cc.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>" + tr + "</tbody></table>");
                    }
                } else {
                    opts.finder.getTr(_20c, _20d + 1, "body", _215).before(tr);
                }
            };
            _20f.call(this, true);
            _20f.call(this, false);
            _213.call(this, true);
            _213.call(this, false);
            data.total += 1;
            data.rows.splice(_20d, 0, row);
            this.refreshRow.call(this, _20c, _20d);
        }, deleteRow: function (_218, _219) {
            var _21a = $.data(_218, "datagrid");
            var opts = _21a.options;
            var data = _21a.data;
            function _21b(_21c) {
                var _21d = _21c ? 1 : 2;
                for (var i = _219 + 1; i < data.rows.length; i++) {
                    var tr = opts.finder.getTr(_218, i, "body", _21d);
                    tr.attr("datagrid-row-index", i - 1);
                    tr.attr("id", _21a.rowIdPrefix + "-" + _21d + "-" + (i - 1));
                    if (_21c && opts.rownumbers) {
                        var _21e = i;
                        if (opts.pagination) {
                            _21e += (opts.pageNumber - 1) * opts.pageSize;
                        }
                        tr.find("div.datagrid-cell-rownumber").html(_21e);
                    }
                    if (opts.striped) {
                        tr.removeClass("datagrid-row-alt").addClass((i - 1) % 2 ? "datagrid-row-alt" : "");
                    }
                }
            };
            opts.finder.getTr(_218, _219).remove();
            _21b.call(this, true);
            _21b.call(this, false);
            data.total -= 1;
            data.rows.splice(_219, 1);
        }, onBeforeRender: function (_21f, rows) {
        }, onAfterRender: function (_220) {
            var opts = $.data(_220, "datagrid").options;
            if (opts.showFooter) {
                var _221 = $(_220).datagrid("getPanel").find("div.datagrid-footer");
                _221.find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility", "hidden");
            }
        }
    };
    $.fn.datagrid.defaults = $.extend({}, $.fn.panel.defaults, {
        sharedStyleSheet: false, frozenColumns: undefined, columns: undefined, fitColumns: false, resizeHandle: "right", autoRowHeight: true, toolbar: null, striped: false, method: "post", nowrap: true, idField: null, url: null, data: null, loadMsg: "Processing, please wait ...", rownumbers: false, singleSelect: false, ctrlSelect: false, selectOnCheck: true, checkOnSelect: true, pagination: false, pagePosition: "bottom", pageNumber: 1, pageSize: 10, pageList: [10, 20, 30, 40, 50], queryParams: {}, sortName: null, sortOrder: "asc", multiSort: false, remoteSort: true, showHeader: true, showFooter: false, scrollbarSize: 18, rowStyler: function (_222, _223) {
        }, loader: function (_224, _225, _226) {
            var opts = $(this).datagrid("options");
            if (!opts.url) {
                return false;
            }
            $.ajax({
                type: opts.method, url: opts.url, data: _224, dataType: "json", success: function (data) {
                    _225(data);
                }, error: function () {
                    _226.apply(this, arguments);
                }
            });
        }, loadFilter: function (data) {
            if (typeof data.length == "number" && typeof data.splice == "function") {
                return { total: data.length, rows: data };
            } else {
                return data;
            }
        }, editors: _19e, finder: {
            getTr: function (_227, _228, type, _229) {
                type = type || "body";
                _229 = _229 || 0;
                var _22a = $.data(_227, "datagrid");
                var dc = _22a.dc;
                var opts = _22a.options;
                if (_229 == 0) {
                    var tr1 = opts.finder.getTr(_227, _228, type, 1);
                    var tr2 = opts.finder.getTr(_227, _228, type, 2);
                    return tr1.add(tr2);
                } else {
                    if (type == "body") {
                        var tr = $("#" + _22a.rowIdPrefix + "-" + _229 + "-" + _228);
                        if (!tr.length) {
                            tr = (_229 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index=" + _228 + "]");
                        }
                        return tr;
                    } else {
                        if (type == "footer") {
                            return (_229 == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index=" + _228 + "]");
                        } else {
                            if (type == "selected") {
                                return (_229 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-selected");
                            } else {
                                if (type == "highlight") {
                                    return (_229 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-over");
                                } else {
                                    if (type == "checked") {
                                        return (_229 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-checked");
                                    } else {
                                        if (type == "last") {
                                            return (_229 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]:last");
                                        } else {
                                            if (type == "allbody") {
                                                return (_229 == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]");
                                            } else {
                                                if (type == "allfooter") {
                                                    return (_229 == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index]");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }, getRow: function (_22b, p) {
                var _22c = (typeof p == "object") ? p.attr("datagrid-row-index") : p;
                return $.data(_22b, "datagrid").data.rows[parseInt(_22c)];
            }, getRows: function (_22d) {
                return $(_22d).datagrid("getRows");
            }
        }, view: _1e7, onBeforeLoad: function (_22e) {
        }, onLoadSuccess: function () {
        }, onLoadError: function () {
        }, onClickRow: function (_22f, _230) {
        }, onDblClickRow: function (_231, _232) {
        }, onClickCell: function (_233, _234, _235) {
        }, onDblClickCell: function (_236, _237, _238) {
        }, onBeforeSortColumn: function (sort, _239) {
        }, onSortColumn: function (sort, _23a) {
        }, onResizeColumn: function (_23b, _23c) {
        }, onSelect: function (_23d, _23e) {
        }, onUnselect: function (_23f, _240) {
        }, onSelectAll: function (rows) {
        }, onUnselectAll: function (rows) {
        }, onCheck: function (_241, _242) {
        }, onUncheck: function (_243, _244) {
        }, onCheckAll: function (rows) {
        }, onUncheckAll: function (rows) {
        }, onBeforeEdit: function (_245, _246) {
        }, onBeginEdit: function (_247, _248) {
        }, onEndEdit: function (_249, _24a, _24b) {
        }, onAfterEdit: function (_24c, _24d, _24e) {
        }, onCancelEdit: function (_24f, _250) {
        }, onHeaderContextMenu: function (e, _251) {
        }, onRowContextMenu: function (e, _252, _253) {
        }
    });
})(jQuery);

